package JAVA300.第十二章网络编程;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * ip定位
 */
public class Web01_IpTest {
    public static void main(String[] args) {
        try {
            InetAddress address = InetAddress.getLocalHost();//获取本机
            System.out.println(address.getHostAddress());
            System.out.println(address.getHostName());
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
